package map;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Test {
    public static void main(String[] args) {
        String line="hello world! thinking in java !i love java!";
        Map<Character, Integer> map = new HashMap<>();
        for (int i=0; i < line.length(); i++){
            char c=line.charAt(i);
            if (map.containsKey(c)){
                map.put(c, map.get(c)+1);
            }else {
                map.put(c, 1);
            }
        }
        Set<Map.Entry<Character,Integer>> enrtySet=map.entrySet();
        map.forEach((k,v)-> System.out.println(k+":"+v));
    }
}
